﻿<div ng-controller="enterpriseBalanceController">
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-inverse">
                <div class="panel-heading">
                    <div class="panel-heading-btn">
                        <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
                    </div>
                    <h4 class="panel-title">平台充值查询服务</h4>
                </div>
                <div class="panel-body">
                    <div class="form-inline filter-option">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="pull-right">
                                    <input class="form-control"  type="text" ng-model="filter.keyword" placeholder="请输入企业客户名称">
                                    <input  class="form-control" type="text" ng-model="filter.phone" placeholder="请输入客户手机号(严格匹配)">
                                    <button class="btn btn-sm btn-info" ng-click="reflash()"><i class="fa fa-search"></i> 筛选</button>
                                    <!--<button ui-sref="app.constants.withdraw">提现页面</button>-->
                                </div>
                            </div>
                        </div>
                    </div>
                    <table id="data-table" ng-table="tableParams" template-pagination="template/pagination.html" class="table table-striped table-bordered table-hover table-condensed">
                        <tr ng-repeat="item in $data">
                            <td data-title="'序号'" width="10%" class="text-center">{{ first + $index }}</td>
                            <td data-title="'企业名称'"  class="text-center">{{ item.enterprise_name }}</td>
                            <td data-title="'管理员手机号'"  class="text-center">{{ item.root_phone }}</td>
                            <td data-title="'充值余额'"  class="text-right">{{ item.enterprise_balance | currency }}</td>
                            <td data-title="'最近充值时间'"  class="text-center">{{ item.last_change_time | date: 'yyyy-MM-dd' }}</td>
                            <td class="text-center width-100 text-nowrap">
                                <button class="btn btn-info btn-xs" ng-click="show(item)"><i class="fa fa-edit"></i> 详细</button>&nbsp;&nbsp;
                                <button class="btn btn-success btn-xs" ng-click="add(item)"><i class="fa fa-plus"></i> 充值</button>

                            </td>
                        </tr>
                    </table>
                </div>
                <div class="modal fade" id="modal-show">
                    <div class="modal-dialog" style="width:1100px">
                        <div class="modal-content">
                            <ng-form name="checkForm" novalidate>
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                    <h4 class="modal-title"><i class="fa fa-lg fa-edit text-success"></i>{{model.enterprise_name}}--充值详情</h4>
                                </div>
                                <div class="modal-body">
                                    <div class="row">
                                        <div class="col-sm-12">
                                            <div class="form-inline filter-option">
                                                <div class="row">
                                                    <div class="col-md-12">
                                                        <div class="pull-left">
                                                            企业当前余额:{{model.enterprise_balance|currency}}
                                                        </div>
                                                        <div class="pull-right">
                                                            <input type="text" placeholder="请输入开始时间" id="start_time" name="start_time"  class="form-control"  />
                                                            <input type="text" placeholder="请输入结束时间" id="end_time" name="end_time"  class="form-control"  />
                                                            <button class="btn btn-sm btn-info" ng-click="reflash2(model.id)"><i class="fa fa-search"></i> 筛选</button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <table  ng-table="tableParams2" template-pagination="template/pagination.html" class="table table-striped table-bordered table-hover table-condensed">
                                                <tr ng-repeat="item in $data">
                                                    <td data-title="'序号'" width="10%" class="text-center">{{ first + $index }}</td>
                                                    <td data-title="'充值金额'" sortable="'change_price'" class="text-center">{{ item.change_price|currency }}</td>
                                                    <td data-title="'充值类型'" sortable="'change_type'" class="text-center">{{ item.change_type == 1 ? "充值":"消费" }}</td>
                                                    <td data-title="'充值前金额'"  class="text-center">{{ item.change_before_balance |currency }}</td>
                                                    <td data-title="'充值后金额'"  class="text-center">{{ item.change_after_balance |currency}}</td>
                                                    <td data-title="'充值员'" class="text-center">{{ item.operator_name }}</td>
                                                    <td data-title="'充值时间'" sortable="'change_time'" class="text-right">{{ item.change_time | date: 'yyyy-MM-dd'}}</td>
                                                    <td data-title="'充值原因'"   class="text-center"><div style="word-wrap:break-word;width: 100px;">{{ item.description }}</div></td>
                                                    <td data-title="'开票记录'" class="text-center">                                                  
                                                    <div class="tb-booth tb-pic tb-s150" ngf-select="uploadFiles($files, $invalidFiles, setMakeBillID,item)" ngf-pattern="'image/*'" accept="image/jpeg,image/gif,image/png" ngf-max-size="10MB">                     
                                                        <img class="jqzoom" src="{{item.bill_photo_url}}" rel="{{item.bill_photo_url}}" alt="未开票，点击上传" />              
                                                    </div>
                                                    <div ng-if="item.is_made_bill == 1">
                                                        已开票,点击图片替换&nbsp;&nbsp;
                                                        <span>
                                                            <button ng-click="zoomPic(item.bill_photo_url)">查看大图</button>
                                                        </span>
                                                    </div>
                                                    </td>

                                                </tr>

                                            </table>

                                        </div>

                                    </div>

                                </div>
                                <div class="modal-footer">
                                    <button class="btn btn-sm btn-white" data-dismiss="modal"><i class="fa fa-share-square-o"></i> 关闭</button>
                                </div>
                            </ng-form>
                        </div>
                    </div>
                </div>
                <div class="modal fade" id="modal-add">
                    <div class="modal-dialog" style="width:800px">
                        <div class="modal-content">
                            <ng-form name="readForm" novalidate>
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                    <h4 class="modal-title"><i class="fa fa-lg fa-edit text-success"></i>{{model.enterprise_name}}--充值账户</h4>
                                </div>
                                <div class="modal-body">
                                    <div class="row">
                                        <form class="form-horizontal">
                                            <div class="col-sm-12">
                                                <div class="form-group width-full">
                                                    <label class="control-label col-md-2"> 充值金额：</label>
                                                    <div class="col-md-10 ">
                                                        <input class="form-control" ng-model="model.change_balance" type="number" required/>
                                                    </div>
                                                </div>
                                                <div class="form-group width-full">
                                                    <label class="control-label col-md-2"> 充值原因：</label>
                                                    <div class="col-md-10">
                                                        <textarea class="form-control" ng-model="model.description" required></textarea>
                                                    </div>
                                                </div>
                                            </div>
                                        </form>

                                    </div>

                                </div>
                                <div class="modal-footer">
                                    <button class="btn btn-sm btn-success" ng-click="addBalance()" ng-disabled="readForm.$invalid"><i class="fa fa-save"></i> 确定</button>
                                    <button class="btn btn-sm btn-white" data-dismiss="modal"><i class="fa fa-share-square-o"></i> 关闭</button>
                                </div>
                            </ng-form>
                        </div>
                    </div>
                </div>
                <div class="modal fade" id="modal-zoom">
                    <div class="modal-dialog" style="width:800px">
                        <div class="modal-content">
                            <ng-form name="checkForm" novalidate>
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                    <h4 class="modal-title"><i class="fa fa-lg fa-edit text-success"></i>详情</h4>
                                </div>
                                   <img style="margin:20px" src="{{model.bill_photo_path}}">
                                <div class="modal-footer">
                                    <button class="btn btn-sm btn-white" data-dismiss="modal"><i class="fa fa-share-square-o"></i> 关闭</button>
                                </div>
                            </ng-form>                  
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

